<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}

$db_selected = mysql_select_db('test_rs', $link);
if (!$db_selected) {
    die ('Can\'t use foo : ' . mysql_error());
}
if($_GET["act"]=="take"){
	$id=$_GET["id"];
	$query="DELETE FROM readyitems WHERE ID=$id";
	$rs=mysql_query($query);
	echo "{success:true}";
}else{
	
	$result = mysql_query("select * from readyitems");
	echo "{Rows:[";
	$i=0;
	while ($row = mysql_fetch_object($result)) {
	    if($i!=0)echo ",";
	    echo json_encode($row);
		$i++;
	}
	echo "]}";
}





mysql_close($link);

?>